<?php
use backend\assets\LayuiAsset;

LayuiAsset::register($this);
use yii\helpers\Html;
use yii\widgets\ActiveForm;
use rbac\models\Menu;
$dropList = \yii\helpers\ArrayHelper::merge([''=>'作为一级菜单'],\yii\helpers\ArrayHelper::map($list,'id','val'));
$this->registerJs($this->render('js/form.js'));
/*$this->registerCSsFile('@web/resources/js/selectpage/selectpage.css',['depends'=>'yii\web\YiiAsset','position'=>\yii\web\View::POS_END]);

$this->registerJsFile('@web/resources/js/selectpage/selectpage.min.js',['depends'=>'yii\web\YiiAsset','position'=>\yii\web\View::POS_END]);*/
?>
<div class="menu-create">
    <style>
        .layui-tab-item{
            position: relative;
        }
    </style>
    <div class="menu-form create_box layui-form">
        <?php $form = ActiveForm::begin(); ?>

        <?= $form->field($model, 'name')->textInput(['maxlength' => 128,'class'=>'layui-input']) ?>

        <?= $form->field($model, 'parent')->dropDownList($dropList,['id' => 'parent','lay-filter'=>'parent','class'=>'layui-input']) ?>
        <?= $form->field($model, 'route')->textInput(['id' => 'route','class'=>'layui-input']) ?>

        <?= $form->field($model, 'order')->input('number',['class'=>'layui-input']) ?>

        <div class="layui-input-inline" style='width:240px'>
            <label class="control-label" for="menu-order">图标</label>
            <input placeholder="请输入或选择图标" id="icon" type="text" name="Menu[icon]" value='<?=$model->icon?>' class="layui-input">
        </div>
        <?php echo \yii\helpers\Html::button('打开图标',['class'=>'layui-btn open-icon','style'=>'margin-top: 25px;']);?>

        <div align='right' style="margin-top:15px;">
            <?=
            Html::submitButton($model->isNewRecord ? Yii::t('rbac-admin', 'Create') : Yii::t('rbac-admin', 'Update'), ['class' => $model->isNewRecord? 'layui-btn' : 'layui-btn layui-btn-normal'])
            ?>
        </div>
        <?php ActiveForm::end(); ?>
    </div>


</div>
